package primalgorithms.list;

public class _03ReverseList {
    public static ListNode reverseList(ListNode head) {
        //*递归真的很难啊
        if(head == null || head.next == null){
            return head;
        }
        //保存当前结点的下一个结点
        ListNode next = head.next;
        //保存翻转之后的链表
        ListNode reverse = reverseList(next);
        next.next = head;
        head.next = null;
        return reverse;
    }
}
